package com.cps116.friendstracker;

import java.util.ArrayList;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

import android.util.Log;

public class ProfileUser {
	
	private String uid;
	private List<String> friends; 
	private String[] friendsArray;
	
	public ProfileUser()
	{
		setUserId("");
		friends = new ArrayList<String>();
	}

	public String getUserId() {
		return uid;
	}

	public void setUserId(String uid) {
		this.uid = uid;
	}
	
	public List<String> getFriends()
	{
		return friends;
	}
	
	public void setFriends(List<String> l)
	{
		if(l == null)
		{
			Log.d("I didn't work", "I didn't work");
			return;
		}
		friends = l;
		
		Pattern p = Pattern.compile("(.+?),");
		friendsArray = new String[friends.size()];
		
		for(int i = 0; i < friends.size(); i++)
		{
			Matcher m = p.matcher(friends.get(i));
			if(m.find())
			{
				friendsArray[i] = m.group(1);
			}
		}
		
	}
	
	public String[] getFriendsArray()
	{
		return friendsArray;
	}
	

}
